import { defineStore } from 'pinia'
import axios from '@/api'

export default defineStore('authentication', () => {
    // 业务员申请
    async function apply(data: object, fileNames: Array<string>) {
        await axios.file('/salesman/apply', data, { fileNames, toast: true })
        uni.reLaunch({
            url: '/pages/authentication/authentication' // 
        });
    }
    // 详情
    function getDetail() {
        return axios.get('/salesman/info')
    }
    // 业务员列表
    function salesman(data: Object) {
        return axios.get('/salesman/index', data)
    }

    return { apply, getDetail, salesman }
})